<template>
	<body>
		<div class="loan_nav col_nav">
			<ul>
				<li><a href="javascript:history.go(-1)"><i class="iconfont">&#xe61e;</i></a></li>
				<li><p>钱包</p></li>
				<li></li>
			</ul>
		</div>
		<div class="interval_T">
			
		</div>
		<div>
			<swiper :list="imgList" :show-dots="false" loop auto :aspect-ratio="0.3" dots-position="center" dots-class="custom-bottom"></swiper>
		</div>
		<div class="Commission">
			<ul>
				<li>
					<p>可用资金</p>
				</li>
				<li>
					<router-link to="recharge">
						<input type="button" value="充值">
					</router-link>
				</li>
			</ul>
			
		</div>
		<div class="money">
			<ul>
				<li><i class="iconfont">&#xe601;</i></li>
				<li><p>¥</p></li>
				<li><p>{{usableMoney}}</p></li>
				<li><p>元</p></li>
				<li><router-link to="withdrawals/1"><p>我要提现</p></router-link></li>
				<li><i class="iconfont">&#xe81d;</i></li>
			</ul>
		</div>
		<div class="interval_l col_nav"></div>
		<div class="Commission">
			<ul>
				<li>
					<p>佣金</p>
				</li>
				<li>
					<router-link v-if="memberId" :to="`recommending/${memberId}`">
						<input type="button" value="赚佣">
					</router-link>
				</li>
			</ul>
		</div>
		<div class="money">
			<ul>
				<li><i class="iconfont">&#xe601;</i></li>
				<li><p>¥</p></li>
				<li><p>{{brokerageMoney}}</p></li>
				<li><p>元</p></li>
				<li><router-link to="withdrawals/2"><p>我要提佣</p></router-link></li>
				<li><i class="iconfont">&#xe81d;</i></li>
			</ul>
		</div>
		<div class="interval_l col_nav"></div>
		<div class="Tie">
			<router-link to="replace">
				<ul>
					<li><p>绑定银行卡</p></li>
					<li><i class="iconfont">&#xe81d;</i></li>
				</ul>
			</router-link>
		</div>
		<div class="interval_l col_nav"></div>
		<div class="Tie">
			<router-link to="record">
			 <ul>
			 	<li><p>账单记录</p></li>
			 	<li><i class="iconfont">&#xe81d;</i></li>
			 </ul>
			 </router-link>
		</div>
	</body>
</template>

<script>
export default {
	data() {
		return {
			usableMoney: 0,
			brokerageMoney: 0,
			memberId: null,

			imgList: []
		}
	},
	created() {
		this.query()
		this.queryImg()
	},
	methods: {
		query() {
			this.$http.get('/app/member/userInfo').then(json => {
				const { code, user } = json
				if (code === 0) {
					this.memberId = user.memberId
				}
			})
			this.$http.get('/app/member/usableMoney').then(json => {
				const { code, usableMoney } = json
				if(code === 0) {
					this.usableMoney = usableMoney
				}
			})
			this.$http.get('/app/member/brokerageMoney').then(json => {
				const { code, brokerageMoney } = json
				if(code === 0) {
					this.brokerageMoney = brokerageMoney
				}
			})
		},

		queryImg() {
			this.$http.get('/app/index/carousel', {
				params: { page: 'wallet' }
			}).then(json => {
				const { code, carousel } = json
				if (code === 0) {
					carousel.forEach(n => {
						this.imgList.push({
							url: n.url,
							img: n.imgPath
						})
					})
				}
			})
		}
	}
}
</script>

<style>
</style>